home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / bcfamily / source / seek.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-12  |  844 b   |  33 lines

  1. //
  2. //      *******************************************************************
  3. //        JdeBP C++ Library Routines          General Public Licence v1.00
  4. //            Copyright (c) 1991,1992     Jonathan de Boyne Pollard
  5. //      *******************************************************************
  6. //
  7. // Part of FamAPI.LIB
  8. //
  9.  
  10. #include "famapi.h"
  11. #include "dosdos.h"
  12.  
  13. //
  14. //    Move the file position
  15. //
  16. USHORT _APICALL
  17. DosChgFilePtr ( unsigned short fd,
  18.                 long Pos,
  19.                 unsigned short Whence,
  20.                 long far * OldPos )
  21. {
  22.     _DX = (USHORT)((ULONG)Pos & 0xFFFF) ;
  23.     _CX = (USHORT)((ULONG)Pos >> 16) ;
  24.     _BX = fd ;
  25.     _AX = Whence ;
  26.     _AH = 0x42 ;
  27.     Dos3Call() ;
  28.     if (_FLAGS & 0x0001) return _AX ;
  29.     ((USHORT far *)OldPos)[0] = _AX ;    // Sneaky trick to prevent the
  30.     ((USHORT far *)OldPos)[1] = _DX ;    // compiler extending _AX into _DX.
  31.     return NO_ERROR ;
  32. }
  33.